Package edu.uky.ai.path
Class Location
java.lang.Object
edu.uky.ai.path.Location
public class Location
extends java.lang.Object
A location is anything with an x and y coordinate in 2D space.
- Author:
- Stephen G. Ware
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object other)intgetX()Return the horizontal position of this object.intgetY()Return the vertical position of this object.inthashCode()java.lang.Iterable<Location>neighbors()Returns all locations around this object which are accessible by one step north, south, east, or west.java.lang.StringtoString()
-
Field Details
-
Constructor Details
-
Location
Creates a new location.- Parameters:
map- the map on which this location appearsx- the horizontal locationy- the vertical locationsolid- whether or not the location contains a wall
-
-
Method Details
-
equals
public boolean equals(java.lang.Object other)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getX
public int getX()Return the horizontal position of this object.- Returns:
- the horizontal position
-
getY
public int getY()Return the vertical position of this object.- Returns:
- the vertical position
-
neighbors
Returns all locations around this object which are accessible by one step north, south, east, or west.- Returns:
- all neighboring locations
-